<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <?php include_once MvcReg::$_moduleName . '/views/layout/head.php'; ?>
    <style>
        .modal-dialog{width:1000px;}.cdetail{text-decoration: underline;cursor: pointer;color:blue;margin-top: 15px}
    </style>
</head>
<body>
<?php include_once MvcReg::$_moduleName . '/views/layout/header.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/layout/top-nav.php'; ?>
<div id="main">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-2">
                <?php include_once MvcReg::$_moduleName . '/views/layout/left_menu.php'; ?>
            </div>
            <div class="col-md-12">
                <div class="right-content">
                    <h2>订单信息</h2>
                        <div class="table-responsive">
                            <table class="table table-hover">
                                <thead>
                                <tr class="info">
                                    <th class="col-md-4">配送信息</th>
                                    <th class="col-md-4">订单信息</th>
                                    <th class="col-md-4">折扣信息</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php include MvcReg::$_moduleName . '/views/layout/orderlist_td.php'; ?>
                                        <td>
                                            <?php if (!empty($row['coupons'])) {?>
                                                <table style="margin: 5px;">
                                                <th style="padding-left:5px;">名称\编号</th>
                                                <th style="padding-left:5px;">面值</th>
                                                <th style="padding-left:5px;">折扣金额</th>
                                                <?php foreach ($row['coupons'] as $pk => $pv) {
                                                    ?>
                                                    <tr>
                                                        <td style=""><?php echo $pv["type_name"].'('. $pv["card_type"].')'?></td>
                                                        <td style="padding-left: 5px;text-align: center;"><?php echo $pv["dc_bala"] ?></td>
                                                        <td style="padding-left: 5px;text-align: center;"><?php echo $pv["discount_money"] ?></td>
                                                        <td style="padding-left: 5px;text-align: center;"><?php echo $pv["res_desc"] ?></td>
                                                    </tr>
                                                <?php } ?>
                                                </table>
                                          <?php  } ?>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>

                    <?php if (!empty($row['express_orders']) && $row['status'] != 100){?>
                    <br>
                    <h2>指派信息</h2>
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                            <tr class="info">
                                <th>配送方</th>
                                <th>预计送达时间\取货时间\发单时间</th>
                                <th>商品重量</th>
                                <th>配送方订单号(运费)</th>
                                <th>配送员信息(手机号)</th>
                                <th>配送地址</th>
                                <th>配送状态</th>
                                <th>取件码</th>
                                <th>操作时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php
                              foreach ($row['express_orders'] as $eok => $eov) {
                                  $isdeleted=$eov['isdeleted']==1?'<label class="red">(订单删除)</label>':'';
                                  if($eov['QRCode'] && $eov['status'] == 2 || $eov['status'] == 3){
                                      $QRCode = $eov['QRCode'];
                                      $td = '<td data-toggle="modal" data-target="#GetQRCode" onclick="GetQRCode('."'$QRCode'".')" class="cdetail">'.$QRCode.'</td>';
                                  }else{
                                      $td = '<td></td>';
                                  }
                                  if($eov['express_type'] == 'self'){
                                      $express_no = $eov['shop_express_no'];
                                  }else {
                                      $express_no = $eov['express_order_no'];
                                  }
                                  ?>


                            <tr>
                                <td ><?php echo Data::$_express_type[$eov['express_type']] ?></td>
                                <td ><?php echo $eov["shop_delivery_time"] ?></td>
                                <td ><?php echo $eov["shop_goods_weight"] ?></td>
                                <td ><?php echo $express_no.(empty($eov['express_fee'])?'':'('.$eov['express_fee'].')')  ?></td>
                                <td ><?php echo $eov["express_courier"].(empty($eov['express_mobile'])?'':'('.$eov['express_mobile'].')') ?></td>
                                <td ><?php echo $eov["shop_delivery_address"]?$eov["shop_delivery_address"]:'无修改' ?></td>
                                <td ><?php echo Data::$_express_status[$eov["status"]].$isdeleted ?></td>
                                <?php echo  $td;?>
                                <td ><?php echo substr($eov["updatedt"],0,16)?></td>
                                <td  data-toggle="modal"
                                     data-target="#show_data" onclick="show_data1(<?php echo $eov['id'];?>)" class="cdetail">查看详情</td>
                            </tr>
                            <?php }  ?>
                            </tbody>
                        </table>
                    </div>
                    <?php }?>

                    <?php if (!empty($row['shop_delivery_address']) && $row['status'] != 100){?>
                    <br>
                    <h4>收货信息修改记录</h4>
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                            <tr class="info">
                                <th>序号</th>
                                <th>原地址</th>
                                <th>修改后地址</th>
                                <th>操作时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($row['shop_delivery_address'] as $k=>$sda){?>
                                <tr>
                                    <td>
                                        <?php echo $k+1 ?>
                                    </td>
                                    <td>
                                        收货人：<?php echo $sda["old_receiver_name"] ?> <br/>
                                        收货人电话： <?php echo $sda["old_receiver_tel"] ?><br/>
                                        收货人地址：<?php echo $sda["old_receiver_address"] ?>
                                    </td>
                                    <td>
                                        收货人：<?php echo $sda["receiver_name"] ?> <br/>
                                        收货人电话：<?php echo $sda["receiver_tel"] ?><br/>
                                        收货人地址：<?php echo $sda["receiver_address"] ?>
                                    </td>
                                    <td><?php echo $sda["createdt"] ?></td>
                                </tr>
                            <?php }  ?>
                            </tbody>
                        </table>
                    </div>
                    <?php }?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php include_once MvcReg::$_moduleName . '/views/layout/footer.php'; ?>

<?php
if($row['status'] != 100){
    include_once MvcReg::$_moduleName . '/views/dialog/order_delivery_infoView.php';
    include_once MvcReg::$_moduleName . '/views/dialog/GetQRCodeView.php';
    include_once MvcReg::$_moduleName . '/views/dialog/edit_addressView.php';
}
 ?>
</body>
</html>
